﻿package communication1.pfl;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class SettingActivity extends Activity {
	private EditText ip = null;
	private EditText port = null;
	private EditText database_ip = null;
	private EditText database_port = null;
	private EditText database_username = null;
	private EditText database_pwd = null;
	private EditText database_sid = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.setting);
		initView();
	}

	public String toString(){
		return "ip=	"+ip.getText().toString()+",port="+port.getText().toString()+",database_ip="+database_ip.getText().toString()+",database_port="+database_port.getText().toString()+",database_username="+database_username.getText()+",database_pwd="+database_pwd.getText()+",database_sid="+database_sid.getText()+"";
	}
	private void initView() {
		{
			ip = (EditText) findViewById(R.id.ip);
			port = (EditText) findViewById(R.id.port);
			database_ip = (EditText) findViewById(R.id.database_ip);
			database_port = (EditText) findViewById(R.id.database_port);
			database_username = (EditText) findViewById(R.id.database_username);
			database_pwd = (EditText) findViewById(R.id.database_pwd);
			database_sid = (EditText) findViewById(R.id.database_sid);
		}
		{
			findViewById(R.id.finish).setOnClickListener(
					new View.OnClickListener() {

						@Override
						public void onClick(View v) {
							// TODO Auto-generated method stub
							finish();
						}
					});

			findViewById(R.id.connect_server_test).setOnClickListener(
					new OnClickListener() {

						@Override
						public void onClick(View arg0) {
							// TODO Auto-generated method stub
							Toast.makeText(SettingActivity.this, toString(), Toast.LENGTH_SHORT).show();
						}
					});
			findViewById(R.id.connect_database_test).setOnClickListener(
					new OnClickListener() {

						@Override
						public void onClick(View arg0) {
							// TODO Auto-generated method stub
							Toast.makeText(SettingActivity.this, toString(), Toast.LENGTH_SHORT).show();
						}
					});
		}

	}
}
